package cn.xiaomubiao.oschine.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.xiaomubiao.oschine.R;
import cn.xiaomubiao.oschine.bean.User;

/**
 * Created by King Su on 2017/4/2.
 */

public class FindUserAdapter extends BaseAdapter {
    List<User> mUserList = new ArrayList<>();

    public FindUserAdapter(List<User> list) {
        mUserList = list;
    }

    @Override
    public int getCount() {
        return mUserList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = View.inflate(convertView.getContext(), R.layout.view_finduser_item, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder  = (ViewHolder) convertView.getTag();
            //获取数据后写上set
        }

        return convertView;
    }

    static class ViewHolder {
        @BindView(R.id.iv_find_item_icon)
        ImageView mIvFindItemIcon;
        @BindView(R.id.tv_find_item_name)
        TextView mTvFindItemName;
        @BindView(R.id.iv_find_item_sex)
        ImageView mIvFindItemSex;
        @BindView(R.id.tv_find_item_address)
        TextView mTvFindItemAddress;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
